//package com.springboot.demo.common.config.security;
//
//
//import org.springframework.security.authentication.encoding.Md5PasswordEncoder;
//import org.springframework.security.crypto.password.PasswordEncoder;
//
///**
// * 对登陆密码进行加密后在传到数据库
// */
//public class CustomPasswordEncoder implements PasswordEncoder{
//    密码加密
//    @Override
//    public String encode(CharSequence rawPassword) {
//        Md5PasswordEncoder encoder = new Md5PasswordEncoder();
//        //将密码加盐
//        return encoder.encodePassword(rawPassword.toString(),"salt1");
//    }
//
//    //验证密码是否匹配
//    @Override
//    public boolean matches(CharSequence rawPassword, String encodedPassword) {
//        Md5PasswordEncoder encoder = new Md5PasswordEncoder();
//        return encoder.isPasswordValid(encodedPassword,rawPassword.toString(),"salt1");
//    }
//}
